package com.abner.springcloud.consumer.movie.service;

import com.abner.springcloud.consumer.movie.engity.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Abner.Jiang
 * @Description:
 * @Date: Created on 2019/12/18 16:03
 * @ProjectName: springcloud-provider-user
 */
@FeignClient(name = "SPRINGCLOUD-PROVIDER-USER")
public interface UserFeignClient {

    /**
     * 通过id查询
     * @param id
     * @return user对象
     */
    @RequestMapping(value = "/user/get/{id}",method = RequestMethod.GET)
    public User getUserById(@PathVariable("id") String id);

    /**
     * 通过id和username查询
     * @param id
     * @param username
     * @return
     */
    @RequestMapping(value = "/user/get",method = RequestMethod.GET)
    public User getUserByIdAndUsername(@RequestParam("id") String id,@RequestParam("username") String username);

    /**
     * 新增用户
     * @param user
     * @return 是否成功：success ， failed
     */
    @PostMapping("/user/add")
    public String addUser(@RequestBody  User user);

}
